
const customRequst = require('../../../common/customRequst');
let app = getApp();
Page({
  data: {
    isSubmit: false,
  },

  formSubmit:function(e){
    let that = this
    if (that.data.isSubmit) {
      wx.showToast({
        title: '请勿重复提交',
        icon: 'none'
      })
      return;
    }
  
  
    let content = e.detail.value.content
    if (!content) {
      wx.showToast({
        title: '反馈建议不能为空',
        icon: 'none'
      })
      return;
    }
    that.setData({
      isSubmit: true
    })
    customRequst.postRequest('/api/sysmsg/addproposal', {
      content: content,
    }).then(function(res){
      if(res.code == 1){
          wx.showToast({
            title: '提交成功',
            icon:'success',
          });
          setTimeout(function(){
              wx.switchTab({
                url: '/pages/users/index/index',
              });
          },2000);
      }else{
        wx.showToast({
          title: res.msg,
          icon:'none'
        })
      }
    })
  }
})